package com.demo.alipay.study.controller;

import com.demo.alipay.study.entity.ProductCourse;
import com.demo.alipay.study.service.course.ProductCourseService;
import com.demo.alipay.study.vo.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author: lvfeilong
 */
@Controller
public class ProductCourseController {

    @Autowired
    private ProductCourseService productCourseService;

    /**
     * 获取课程信息
     *
     * @return 课程信息
     */
    @PostMapping("/api/load/course")
    @ResponseBody
    public ResultResponse loadCourse() {
        List<ProductCourse> courseList = productCourseService.list();
        return ResultResponse.ok().data("courseList", courseList);
    }
}
